<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://xmlns.jcp.org/jsf/core">
    <ui:composition template="Template.xhtml">
        <ui:define name="top">
            #{bundle.order}#{bundle.manage} 

        </ui:define>
        <ui:define name="content">
            <f:event listener="#{customerdemandMB.init()}"
                     type="preRenderView"></f:event>

            <!--<p:outputPanel deferred="true" >-->
            <!--<shiro:hasPermission name="user:V">--> 
            <h:form id="form">
                <div style="text-align: right">
                    <p:outputLabel for="servicedateselection" value="配送日期:" />
                    <p:calendar id="servicedateselection" value="#{customerdemandMB.servicedateselection}" pattern="yyyy-MM-dd" mask="true">
                        <p:ajax event="dateSelect" update="form" listener="#{customerdemandMB.onSVDateChange()}" />
                    </p:calendar>
                </div>


                <p:dataTable var="item" value="#{customerdemandMB.items}" paginator="true" rows="10"
                             paginatorTemplate="{RowsPerPageDropdown} {FirstPageLink} {PreviousPageLink} {CurrentPageReport} {NextPageLink} {LastPageLink}"
                             rowsPerPageTemplate="5,10,15"   id="Table" lazy="true">
                    <p:column headerText="#{bundle.order}#{bundle.id}" sortBy="#{item.idcustomerdemand}" filterBy="#{item.idcustomerdemand}">
                        <h:outputText value="#{item.idcustomerdemand}" />
                    </p:column>
                    <p:column headerText="#{bundle.date}" sortBy="#{item.servicedate}" filterBy="#{item.servicedate}">
                        <h:outputText value="#{item.servicedate}">
                            <f:convertDateTime pattern="YYYY/MM/dd"  />
                        </h:outputText>
                    </p:column>
<!--                        <p:column headerText="#{bundle.idcustomer}" sortBy="#{item.idcustomer}" filterBy="#{item.idcustomer}">
                        <h:outputText value="#{item.idcustomer}" />
                    </p:column>-->
                    <p:column headerText="#{bundle.customer}" sortBy="#{item.idcustomer.iduser.name}" filterBy="#{item.idcustomer.iduser.name}" >
                        <h:outputText value="#{item.idcustomer.iduser.name}" />
                    </p:column>
                    <p:column headerText="#{bundle.tel}" sortBy="#{item.tel}" filterBy="#{item.tel}">
                        <h:outputText value="#{item.tel}" />
                    </p:column>
                    <p:column headerText="#{bundle.address}" sortBy="#{item.address}" filterBy="#{item.address}">
                        <h:outputText value="#{item.address}" />
                    </p:column>
                    <p:column headerText="#{bundle.readyTime}" sortBy="#{item.readyTime}" >

                        <h:outputText value="#{item.readyTime}">
                            <f:convertDateTime pattern="HH:mm" />
                        </h:outputText>
                    </p:column>
                    <p:column headerText="#{bundle.dueDate}" sortBy="#{item.dueDate}" >
                        <h:outputText value="#{item.dueDate}">
                            <f:convertDateTime pattern="HH:mm"  />
                        </h:outputText>
                    </p:column>
                    <p:column headerText="#{bundle.serviceTime}" sortBy="#{item.serviceTime}" style="width: 8%;text-align: center;">
                        <h:outputText value="#{item.serviceTime}" />
                    </p:column>
                    <p:column headerText="#{bundle.status}" sortBy="#{item.status}" style="width: 8%;text-align: center;">
                        <h:outputText rendered="#{item.status==1}" value="#{item.arrivetime}">
                            <f:convertDateTime pattern="HH:mm"  />
                        </h:outputText>
                        <h:outputText value="#{item.status}" converter="#{customerDemandStatusConvert}" />

                    </p:column>
                    <p:column style="width: 10%;text-align: center;">
                        <f:facet name="header">
                            <h:outputText value="#{bundle.operation}"/>
                            <!--<shiro:hasPermission name="user:C">--> 
                            <p:button value="#{bundle.create}"  onclick="window.parent.addTab('#{bundle.create}#{bundle.order}', 'customerdemand/create.xhtml');" style="font-size:0.9em" icon="ui-icon-plus">
                            </p:button>
                            <!--</shiro:hasPermission>-->
                        </f:facet>
                        <p:commandButton value="#{bundle.view}"    onclick="window.parent.addTab('#{item.idcustomerdemand}', 'user/user.xhtml?userid=' + '#{item.idcustomerdemand}');" >
                        </p:commandButton>
                        <!--<shiro:hasPermission name="user:D">--> 
                        <p:commandButton value="#{bundle.delete}" action=" " update=":form,:growl" >
                            <p:confirm header="#{bundle.delete}" message="#{bundle.deleteAlert}" icon="ui-icon-alert" />
                        </p:commandButton>
                        <!--</shiro:hasPermission>-->
                    </p:column>
                </p:dataTable>
                <p:blockUI block="Table" trigger="Table">
                    LOADING<br />
                    <p:graphicImage name="img/ajaxloadingbar.gif"/>
                </p:blockUI>

                <p:confirmDialog global="true" showEffect="fade" hideEffect="fade">
                    <p:commandButton value="Yes" type="button" styleClass="ui-confirmdialog-yes" icon="ui-icon-check" />
                    <p:commandButton value="No" type="button" styleClass="ui-confirmdialog-no" icon="ui-icon-close" />
                </p:confirmDialog>
            </h:form>
            <!--</p:outputPanel>-->
            <!--</shiro:hasPermission>-->
        </ui:define>
    </ui:composition>
</html>

